package com.example.compose.retrofit

import com.example.compose.retrofit.entity.LastUpdate
import com.example.compose.retrofit.entity.Reply
import okhttp3.ResponseBody
import org.json.JSONObject
import retrofit2.Call
import retrofit2.http.*

interface ApiService {

    @FormUrlEncoded
    @POST("app/lastUpdate")
    fun getLastUpdate(@Field("app_id") app_id:String, @Field("platform") platform:String): Call<Reply<LastUpdate>>

    @Streaming
    @GET
    fun download(@Header("Range") range:String, @Url url:String): Call<ResponseBody>

    @FormUrlEncoded
    @POST("app/add_app_crash")
    fun uploadCrashInfo(@FieldMap crash: Map<String,String>): Call<JSONObject>

    @FormUrlEncoded
    @POST("app/count")
    fun uploadInstallInfo(@FieldMap crash: Map<String,String>): Call<JSONObject>

}